<template>
  <el-card>
    <div class="page-tools">
      <!-- 左侧 -->
      <div class="left">
        <div v-if="$slots.left" class="tips">
          <i class="el-icon-info" />
          <slot name="left" />
        </div>
      </div>
      <div class="right">
        <!-- 右侧 -->
        <slot name="right" />
      </div>
    </div>
  </el-card>
</template>

<script>
export default {
  // 如果用户传递了left插槽,显示 ,没有传递left插槽 不显示左侧的tips
  created() {
    // this.$slots 可以获取到当前组件中有几个设置了的插槽 这是一个对象 对象中存储是插槽的键值
    console.log(this.$slots)
  }
}
</script>

<style lang="scss" scoped>
.page-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  .tips {
    line-height: 34px;
    padding: 0px 15px;
    border-radius: 5px;
    border: 1px solid rgba(145, 213, 255, 1);
    background: rgba(230, 247, 255, 1);
		font-size: 12px;
    i {
      margin-right: 10px;
      color: #409eff;
    }
  }
}

</style>
